// 数组根据下标解构
const arr = ["foo", "bar", "baz"];

// const [foo,bar,baz] = arr
// console.log(foo,bar,baz)

// const [,bar,] = arr
// console.log(bar)

// const [foo,...rest] = arr
// console.log(rest)

// const [...rest] = arr;
// console.log(rest);

// const [m,n] = arr
// console.log(m,n)

// const [m,n,k,y] = arr
// console.log(m,n,k,y)

const [m = 1, n, k, y = 5] = arr;
console.log(m, n, k, y);
